package com.boodaba.todocarts.test.domain;


import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Before;
import org.junit.Test;

import com.boodaba.todocarts.domain.Todo;
import com.boodaba.todocarts.domain.TodoIdSpecification;

public class TodoIdSpecificationShould {
	
	TodoIdSpecification SUT;
	private final String mTargetTitle = "some important TODO";

	@Before
	public void setUp() throws Exception {
		SUT = new TodoIdSpecification(mTargetTitle);
	}
	
	@Test
	public void satisfiedByLabelsWithExactTitle() {
		assertTrue(SUT.isSatisfiedBy(new Todo(mTargetTitle)));
		assertFalse(SUT.isSatisfiedBy(new Todo("other title")));
		assertFalse(SUT.isSatisfiedBy(new Todo(mTargetTitle.substring(0, 7))));
		assertFalse(SUT.isSatisfiedBy(new Todo(mTargetTitle + " actually")));
	}
	
	@Test
	public void satisfiedByLabelsCaseSens() {
		assertFalse(SUT.isSatisfiedBy(new Todo(mTargetTitle.toUpperCase())));
	}
	
	@Test
	public void operateWithNullToCheck() {
		assertFalse(SUT.isSatisfiedBy(null));
	}
}
